package xyz.pro5books.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xyz.pro5books.pojo.BookReport;
import xyz.pro5books.service.BookReportService;
import xyz.pro5books.vo.PageResult;
import xyz.pro5books.vo.SysResult;

@RestController
@CrossOrigin
@RequestMapping("/bookReport")
public class BookReportController {
    @Autowired
    private BookReportService bookReportService;

    @GetMapping("/getBookReportList")
    public SysResult getBookReportList(PageResult pageResult){
        pageResult = bookReportService.getBookReportList(pageResult);
        return SysResult.success(pageResult);
    }

    @PutMapping("/updateBookReportStatus/{id}/{settled}")
    public SysResult updateBookReportStatus(BookReport bookReport){
        bookReportService.updateBookReportStatus(bookReport);
        return SysResult.success();
    }

    @DeleteMapping("/deleteBookReportById")
    public SysResult deleteBookReportById(Integer id){
        bookReportService.deleteBookReportById(id);
        return SysResult.success();
    }
}
